From 92279a682103333c660c67091db1245bd4b41f42 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sun, 4 Dec 2005 11:54:04 +0100 Subject: [PATCH] Add a comment to tricky corner case in evtchn_close(). Signed-off-by: Rusty Russell Signed-off-by: Keir Fraser --- xen/common/event_channel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 6f5a34774b..c3ef30ce34 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -344,6 +344,14 @@ static long __evtchn_close(struct domain *d1, int port1) } else if ( d2 != chn1->u.interdomain.remote_dom ) { + /* + * We can only get here if the port was closed and re-bound after + * unlocking d1 but before locking d2 above. We could retry but + * it is easier to return the same error as if we had seen the + * port in ECS_CLOSED. It must have passed through that state for + * us to end up here, so it's a valid error to return. + */ + BUG_ON(d1 != current->domain); rc = -EINVAL; goto out; } -- 2.30.2